package com.lab.service.impl;

import com.lab.dao.ProjectDao;
import com.lab.pojo.Project;
import com.lab.service.ProjectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("projectService")
public class ProjectServiceImp implements ProjectService {
    @Resource
    ProjectDao projectDao;
    public List<Project> allProjects() {
        return projectDao.allProjects();
    }

    public void saveProject(Project project) {
        if (project.getId()!=null){
            //修改
            projectDao.updateProject(project);
        }else {
            //增加
            projectDao.addProject(project);
        }
    }

    public void deleteProject(Long[] id) {
        projectDao.deleteProject(id);
    }

    public Project findProjectById(Long id) {
        return projectDao.findProjectById(id);
    }

    @Override
    public void saveProjectApply(Project project) {
        projectDao.saveProjectApply(project);
    }


}
